// Programming_Scala/src/ch01/shapes-actor.scala

package shapes {
  import scala.actors._
  import scala.actors.Actor._

  object ShapeDrawingActor extends Actor {
    def act() {
      // rkuhar: loop is a function, but its not on Actor?  Hmmm.  Where is it then?
      loop {
        // rkuhar: receive is a function found on Actor.
        receive {
          // rkuhar: Our old friend "pattern matching" is here...
          case s:Shape => s.draw
          case "exit" => println( "exiting..." ); exit
          case x:Any => println( "Error: Unknown message! " + x )
        }
      }
    }
  }
}
